package file;


import java.io.File;
import java.io.IOException;

public class FileTest1 {

    public static void main(String[] args) {
       // File fi = new File("D:\\zjd.code");
        File fi = new File("D:/zjd.code");
       // File fi = new File("D: " + File.separator + " +  zjd.code");
        System.out.println(fi.length());// 文件大小  字节数


        File f2 = new File("D:/zjd/aaa.txt");
        System.out.println(f2.length());
        System.out.println(f2.exists());

        // 绝对路径  带盘符的
        //File f4 = new File("C:\Users\zjd\IdeaProjects\java\src\itheima.txt");
        // 相对路径  不带盘符   默认从工程下寻找
        File f4 = new File("src\\itheima.txt");
        try {
            //f4.mkdirs();
            boolean newFile = f4.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }

        System.out.println(f4.length());
        System.out.println(f4.exists());
    }
}
